<template>
  <Module-box title="扫码报修提醒" height="293px" bg="short1">
    <G-table id="sm" :columns="columns" :data="dataList" :speed="3" hover height="220" />
  </Module-box>
</template>
<script>
import { getScanCodeWarrantyReminder } from "@/utils/screen";
export default {
  data() {
    return {
      columns: [
        { label: "ID", prop: "id", align: "left", width: 40 },
        {
          label: "客户名称",
          align: "left",
          scroll: false,
          width: 120,
          default: (row, column) => {
            let text;
            if (column.scroll) {
              text = row.hospitalName || "-";
            } else {
              let frist = row.hospitalName ? row.hospitalName[0] : "";
              text = frist ? frist + "*".repeat(row.hospitalName.length - 1) : "-";
            }
            return text;
          },
        },
        { label: "科室", prop: "departmentName", align: "left" },
        { label: "型号", prop: "threeClassName", align: "left" },
        { label: "故障现象", prop: "problem", align: "left" },
      ],
      dataList: [], // 数据列表
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    // 获取扫码报修提醒列表
    getList() {
      getScanCodeWarrantyReminder().then((res) => {
        if (res && res.code == 1) {
          this.dataList = res.data || [];
          if (this.dataList.length > 0) {
            let ring = this.dataList.some((i) => i.status == "0");
            this.$emit("ring", ring);
          }
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped></style>
